var w = new Window('dialog', 'Autosize Test');
w.margins = 20;
// Dialog Width To Be Defined:
var w_width = 400;
// Stactic Text To Be Defined:
w_statictext = 'This is a dynamically sized message. It can be short or it can be very long. \nIt should wrap nicely and the box should grow vertically to fit the text without cutting off or overflowing weirdly. \n\nThis Solution is not mine but written by Marc Autret from Indiscripts in July 2013.';
var st = w.add('statictext', undefined, 'X', {multiline: true});
var X_width = st.preferredSize[0];
with(st){preferredSize = [-1,-1]; characters = ~~(w_width/X_width); preferredSize[1] = -1;};
st.text = w_statictext;
// "Close" Button:
w.add('button', undefined, 'Close', {name: 'OK'});
w.show(); (^/) The Jedi
... View more